import { Module } from '@nestjs/common';
import { APP_FILTER } from '@nestjs/core';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AllExceptionsFilter } from './filter/anyexception.filter';

import { ZongjuModule } from './modules/zongju/zongju.module';
import { NodeModule } from './modules/node/node.module';
import { NeimengModule } from './modules/neimeng/neimeng.module';
import { GuangdongModule } from './modules/guangdong/guangdong.module';
import { ShanghaiModule } from './modules/shanghai/shanghai.module';
import { SaveInfoModule } from './modules/saveDailyInfo/saveInfo.module';
import { ErrorLianluModule } from './modules/errorLianlu/errorLianlu.module';

@Module({
  imports: [
    ZongjuModule,
    NodeModule,
    NeimengModule,
    GuangdongModule,
    ShanghaiModule,
    SaveInfoModule,
    ErrorLianluModule,
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: 'localhost',
      port: 3306,
      username: 'root',
      password: 'root',
      database: 'lljk',
      entities: [__dirname + '/./**/*.entity.{js,ts}'],
      synchronize: true,
      timezone: 'Z',
    }),
  ],
  providers: [
    {
      provide: APP_FILTER,
      useClass: AllExceptionsFilter,
    },
  ],
})
export class AppModule {}
